package com.tuanzi.loan.business.repository.sms;

import com.tuanzi.loan.business.constants.sms.SmsVoiceSendTaskStatus;
import com.tuanzi.loan.business.entity.sms.SmsSendTaskStatus;
import com.tuanzi.loan.business.entity.sms.SmsVoiceSendTask;
import com.tuanzi.loan.business.repository.sms.custom.SmsVoiceSendTaskRepositoryCustom;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Date;

/**
 * @Author: chenweijun
 * @Date: 2018/10/22 11:46
 * @Description:
 */
public interface SmsVoiceSendTaskRepository extends SmsVoiceSendTaskRepositoryCustom, JpaRepository<SmsVoiceSendTask, Long>{

    SmsVoiceSendTask findTopByCalculateTaskIdAndStatus(Long calculateTaskId, SmsVoiceSendTaskStatus status);

    Long countByStatus(SmsVoiceSendTaskStatus status);

    SmsVoiceSendTask findTopOneByStatusAndExecuteTimeBefore(SmsVoiceSendTaskStatus status, Date executeDate);

}
